<?php
// 获取当前时间
$time = date('Y-m-d H:i:s');

// 获取客户端IP
$ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}

// 获取文件来源和URL
$source_type = $_POST['source_type'] ?? 'unknown';
$file_url = $_POST['file_url'] ?? 'N/A';

// 构建日志内容
$log_content = sprintf(
    "%s-->%s-->%s-->%s\n",
    $time,
    $ip,
    $source_type,
    $file_url
);

// 写入日志文件
$log_file = __DIR__ . '/log.log';
file_put_contents($log_file, $log_content, FILE_APPEND);

// 返回成功状态
header('Content-Type: application/json');
echo json_encode(['status' => 'success']); 